<?php
    class allocine
    {
        public function film($id, $profile = 'medium', $json = 1)
        {
            $html = file_get_contents('http://api.allocine.fr/xml/movie?format=h264&version=2&partner=3&json=' . $json . '&profile=' . $profile .'&code=' . $id);
            if ($json == 1) {
                return json_decode($html, 1);
            }
            return $html;
        }
        
        public function search($q, $json = 1)
        {
            $html = file_get_contents('http://api.allocine.fr/xml/search?q='. urlencode($q) .'&partner=3&json=' . $json);
            if ($json == 1) {
                $tab = json_decode($html, 1);
                return $tab['feed']['movie'];
            }
            return $html;
        }
    }
?>